home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / String Man2984110192001.psc / InStr / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-10-18  |  2.1 KB  |  75 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5805
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   8475
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   5805
  10.    ScaleWidth      =   8475
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.TextBox txtSearch 
  13.       Height          =   375
  14.       Left            =   120
  15.       TabIndex        =   0
  16.       Text            =   "Search String"
  17.       Top             =   120
  18.       Width           =   8175
  19.    End
  20.    Begin VB.CommandButton Command1 
  21.       Caption         =   "CALCULATE"
  22.       Height          =   615
  23.       Left            =   2760
  24.       TabIndex        =   2
  25.       Top             =   5040
  26.       Width           =   2535
  27.    End
  28.    Begin VB.TextBox txtString 
  29.       BeginProperty Font 
  30.          Name            =   "Arial"
  31.          Size            =   12
  32.          Charset         =   0
  33.          Weight          =   400
  34.          Underline       =   0   'False
  35.          Italic          =   0   'False
  36.          Strikethrough   =   0   'False
  37.       EndProperty
  38.       Height          =   3975
  39.       Left            =   120
  40.       MultiLine       =   -1  'True
  41.       TabIndex        =   1
  42.       Text            =   "Form1.frx":0000
  43.       Top             =   720
  44.       Width           =   8175
  45.    End
  46. Attribute VB_Name = "Form1"
  47. Attribute VB_GlobalNameSpace = False
  48. Attribute VB_Creatable = False
  49. Attribute VB_PredeclaredId = True
  50. Attribute VB_Exposed = False
  51. Private Sub Command1_Click()
  52.     On Error GoTo iNext
  53.     Dim i As Long
  54.     Dim Count As Long
  55.     Dim ExitLoop As Boolean
  56.     ExitLoop = False
  57.     Count = 0
  58.     i = 1
  59.     Do
  60.         i = InStr(i, LCase(txtString), LCase(txtSearch))
  61.         If Not i = 0 Then
  62.             Count = Count + 1
  63.             i = i + 1
  64.             ElseIf i = 0 Then
  65.             GoTo iNext
  66.         End If
  67.     Loop
  68. iNext:
  69. If Count > 1 Or Count = 0 Then
  70.     MsgBox "There were " & Count & " words that matched your query"
  71.     Else
  72.     MsgBox "There was " & Count & " word that matched your query"
  73. End If
  74. End Sub
  75.